Store only the part of seconds for trackpoints (computed from milliseconds).
authoroliskoli <oliskoli>
Wed, 14 Feb 2007 21:20:33 +0000 (21:20 +0000)
committeroliskoli <oliskoli>
Wed, 14 Feb 2007 21:20:33 +0000 (21:20 +0000)
Rebuild reference data.

defs.h
stmwpp.c

diff --git a/defs.h b/defs.h
index ba16cca360de3e0bc74cffa17b4067073e66f483..8262323ea8e78f647f5c333a364b697be744002c 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -163,6 +163,8 @@ extern const char gpsbabel_version[];
 extern time_t gpsbabel_now;    /* gpsbabel startup-time; initialized in main.c with time() */
 extern time_t gpsbabel_time;   /* gpsbabel startup-time; initialized in main.c with current_time(), ! ZERO within testo ! */
 
+#define MILLI_TO_MICRO(t) (t * 1000)  /* Milliseconds to Microseconds */
+#define MICRO_TO_MILLI(t) (t / 1000)  /* Microseconds to Milliseconds*/
 #define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */
 #define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */
 
index f82f5e43c163638b21d84b8b103a8eee3c1f1606..1842454243c4f6474f7d10d693b5b42fe1113efc 100644 (file)
--- a/stmwpp.c
+++ b/stmwpp.c
@@ -137,9 +137,9 @@ stmwpp_data_read(void)
                                        
                                case 6:
                                        sscanf(c, "%d:%d:%d.%d", &time.tm_hour, &time.tm_min, &time.tm_sec, &fracsec);
-                                       wpt->microseconds = CENTI_TO_MICRO(fracsec);
-                                       if (what == STM_TRKPT)
-                                               wpt->microseconds /= 10;
+                                       wpt->microseconds = MILLI_TO_MICRO(fracsec);
+                                       /* makes sense only for recorded trackpoints */
+                                       if (what != STM_TRKPT) wpt->microseconds = 0;
                                        break;
                                        
                                default:
@@ -249,10 +249,10 @@ stmwpp_waypt_cb(const waypoint *wpt)
        {
                case STM_WAYPT:
                case STM_RTEPT:
-                       gbfprintf(fout, ".%02d", MICRO_TO_CENTI(wpt->microseconds));
+                       gbfprintf(fout, ".%02d", 0);
                        break;
                case STM_TRKPT:
-                       gbfprintf(fout, ".%03d", MICRO_TO_CENTI(wpt->microseconds * 10));
+                       gbfprintf(fout, ".%03d", MICRO_TO_MILLI(wpt->microseconds));
                        break;
        }
        gbfprintf(fout, ",\r\n");